<template>
  <div class="child">
    <h3>子组件1</h3>
    <h1>玩具：{{ toy }}</h1>
    <!-- 收到事件emit触发事件 -->
    <button @click="emitter.emit('send-toy', toy)">给弟弟玩具</button>
  </div>
</template>

<script setup lang="ts" name="Child">
import { ref } from "vue";
import emitter from "@/utlis/emitt";

const toy = ref("小汽车");
</script>

<style scoped>
.child {
  background-color: skyblue;
  padding: 10px;
  border-radius: 10px;
  box-shadow: 0 0 10px black;
}
</style>
